#include "Object.h"

Object::Object(const QByteArray& data, bool builtin) 
: _builtin(builtin)
, _buffer(data)
{};

QByteArray Object::Data()
{
    return _buffer;
}

bool Object::IsDigit()
{
    bool ok = false;
    _buffer.toInt(&ok);
    
    return ok;
}

int Object::ToInt()
{
    return _buffer.toInt();
}

void Object::Reset()
{
    if (!_builtin) _buffer.clear();
}

void Object::Add(CharTypePtr character)
{
    if (!_builtin && character) _buffer.append(character->Value());
}

